package com.zhong.bmob.server;

import com.zhong.bmob.inter.IChatMessageUpLoadDown;
import com.zhong.bmob.model.ChatMessageBase;

import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;

/**
 * Created by 俊峰 on 2017/5/23.
 */

public class ChatMessageUpLoad {
    public static void chatMessageUpLoad(ChatMessageBase chatMessageBase, IChatMessageUpLoadDown messageUpLoadDown){
        final IChatMessageUpLoadDown chatMessageUpLoadDown = messageUpLoadDown;
        chatMessageBase.save(new SaveListener<String>() {
            @Override
            public void done(String s, BmobException e) {
                if (e == null){
                    chatMessageUpLoadDown.chatMessageUpLoadSuccess(s);
                }else {
                    chatMessageUpLoadDown.chatMessageUpLoadFail(e);
                }
            }
        });
    }
}
